package com.yl.auth.controller;

import com.alibaba.excel.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yl.auth.entity.ChuyuanjiesuanBean;
import com.yl.auth.mapper.ChuyuanjiesuanMapper;
import com.yl.auth.model.vo.ChuYuanQueryVo;
import com.yl.auth.model.vo.ChuyuanjiesuanVo;
import com.yl.auth.service.ChuyuanjiesuanService;
import com.yl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author 王帅洋
 * @datetime 2023/6/27 15:44
 * @description 类对象
 */
@Api(tags = "财务收支-出院结算")
@RestController
@RequestMapping("/admin/caiwushouzhi/chuyuanjiesuan")
@CrossOrigin
public class ChuyuanjiesuanController {
    @Resource
    private ChuyuanjiesuanService chuyuanjiesuanService;

    @ApiOperation("分页条件查询")
    @GetMapping("/{page}/{limit}")
    public Result selectPage(@PathVariable @ApiParam("当前页") Long page, @PathVariable @ApiParam("总条数") Long limit, @ApiParam("出院结算实体类") ChuyuanjiesuanBean chuyuanjiesuanBean) {
        Page<ChuyuanjiesuanBean> page1 = new Page<>(page, limit);
        IPage<ChuyuanjiesuanBean> page2 = chuyuanjiesuanService.selectpage(page1, chuyuanjiesuanBean);
        System.out.println("=================================="+chuyuanjiesuanBean.getLaorenname());
        return Result.ok(page2);
    }

    @ApiOperation("根据id查询")
    @GetMapping("/getById/{id}")
    public Result getById(@PathVariable Long id) {
        ChuyuanjiesuanBean chuyuanjiesuanBean = chuyuanjiesuanService.getById(id);
        return Result.ok(chuyuanjiesuanBean);
    }

    @ApiOperation("根据id修改")
    @PostMapping("/updateById/{id}")
    public Result update(@PathVariable Long id) {
        chuyuanjiesuanService.updatechuyuan(id);
        return Result.ok();

    }
}
